import request from '@/utils/request'

export function getDepartments() {
  return request({
    url: '/company/department'
  })
}

// 删除阻止架构不猛
export function delDepartments(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete' // 接口满足restful接口规范
    // 同样的地址 不同的方法 执行不同的业务
  })
}

// 新增部门
export function addDepartments(data) {
  return request({
    url: '/company/department', // restful接口规范
    method: 'post',
    data
  })
}

// 获取部门详情
export function getDepartDetail(id) {
  return request({
    url: `/company/department/${id}`
  })
}

// 保存编辑的数据
export function updateDepartments(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}
